

<div class="spage-main-box">
    <{if $order}>
        <{if $order.is_has_remote_pdts!=='true'}>
            <{include file="admin/order/order_edit.html"}>
        <{elseif $order.is_has_remote_pdts=='true'}>
        
            <{include file="admin/order/edit_po.html"}> 
            
        <{/if}>   
	<{else}>   
        <{include file="admin/order/detail/detail.html"}> 
    <{/if}>   
</div>

<script language='javascript'>
function picking(product_id){
    showDiv(product_id,function(){
        var inputIds = $$('[name="goodsmadan_ids['+product_id+']"]');
        var inputMi = $$('[name="goodsnum['+product_id+']"]');
        var inputJu = $$('[name="goodsjuanshu['+product_id+']"]');
        var madan_ids=inputIds.get('value');
        var mishu=inputMi.get('value');
        var juanshu=inputJu.get('value');
        var inputs = document.getElementsByName('chkRoll[]');//获取所有的input标签对象。
        if (madan_ids != '') {
            var arr=madan_ids[0].split(',');//注split可以用字符或字符串分割
            for (var i=0;arr[i];i++){
               $$("[id='chkRoll["+arr[i]+"]']").set('checked','checked');
                // console.log();
            }

            //往选中之中填值 
            //合计显示在页面上
            var totalStr="<b>选中:"+"<font color='red'>"+juanshu+"</font>&nbsp;&nbsp;卷&nbsp;&nbsp;共:"+"<font color='red'>"+mishu+"</font>&nbsp;&nbsp;M</b> <div type='hidden' id='total' value='"+mishu+"' cntJuan='"+juanshu+"' madan_ids='"+madan_ids+"'></div> ";
            var spanDiv=window.document.getElementById ("divTotal");
            spanDiv.innerHTML = totalStr;
        }
    });
}
//添加配货单选择 by 张艳 2015-10-26 
function pickPeihuo(product_id){
    var inputName=$$('[name="order[login_name]"]');
    var userName=inputName.get('value');
    showPeihuo(product_id,userName,function(){
        var inputIds = $$('[name="goodsmadan_ids['+product_id+']"]');
        var inputMi = $$('[name="goodsnum['+product_id+']"]');
        var inputJu = $$('[name="goodsjuanshu['+product_id+']"]');
        var inputPei = $$('[name="goodsPei['+product_id+']"]');
        var madan_ids=inputIds.get('value');
        var mishu=inputMi.get('value');
        var juanshu=inputJu.get('value');
        var peihuoCode=inputPei.get('value');
        var inputs = document.getElementsByName('chk[]');//获取所有的input标签对象
        if (peihuoCode != '') {
            var arr=peihuoCode[0].split(',');//注split可以用字符或字符串分割
            for (var i=0;arr[i];i++){
               $$("[id='chk["+arr[i]+"]']").set('checked','checked');
            }
            //往选中之中填值 
            //合计显示在页面上
            var totalStr="<div type='hidden' id='total' value='"+mishu+"' cntJuan='"+juanshu+"' madan_ids='"+madan_ids+"' peihuoCode='"+peihuoCode+"'></div> ";
            var spanDiv=window.document.getElementById ("divTotal");
            spanDiv.innerHTML = totalStr;
        }
    });
}
	/*
}
}
* 弹出DIV层
*/
//这是个全局变量，为了关闭增加 2015-9-11 by jeff
// var _dialog = null;
function showDiv(product_id,onShow) {
    var dialog = new Dialog('<{link app=b2c ctl=admin_order act=select_bujuan}>', {
        width: 800,
        height: 560,
        title: '选择布卷',
        modal: true,
        async: 'ajax',
        //后台跟前台所用的js不一样，后台用的是tools_mins.js参数改为ajaxoptions，onLoad执行异步方法
        onLoad:function() {
        	onShow();
        },
        ajaxoptions: {
            method: 'post',
            data: 'product_id='+product_id
        }
    });
    closeDiv = function() {
        dialog.hide();
    }
}
//这是个全局变量，为了关闭增加 2015-9-11 by jeff
// var _dialog = null;
function showPeihuo(product_id,userName,onShow) {
    var dialog = new Dialog('<{link app=b2c ctl=admin_order act=select_peihuo}>', {
        width: 800,
        height: 560,
        title: '选择配货单',
        modal: true,
        async: 'ajax',
        //后台跟前台所用的js不一样，后台用的是tools_mins.js参数改为ajaxoptions，onLoad执行异步方法
        onLoad:function() {
            onShow();
        },
        ajaxoptions: {
            method: 'post',
            data: 'product_id='+product_id+'&userName='+userName
        }
    });
    closeDiv = function() {
        dialog.hide();
    }
}
//var closeDiv = function(){};//空函数
</script>